<?php
/**
 * Created by PhpStorm.
 * User: gaoweihua
 * Date: 2019/2/17
 * Time: 2:51 PM
 */

//13955555555,13955555556,13955555557,13955555558,13955555559

if(isset($_POST['sub'])){
    $client = new swoole_client(SWOOLE_SOCK_TCP);
    if (!$client->connect('127.0.0.1', 9526, -1))
    {
        exit("connect failed. Error: {$client->errCode}\n");
    }
    $data = $_POST['data'];
    $client->send($data);
    $x = $client->recv(65535,0);
    //var_dump($x);
    $client->close();
}

//swoole_timer_tick(2000, function($timer_id){
//    echo PHP_EOL;
//    echo '你好开始';
//    Co::sleep(3);
//    echo '你好结束';
//});

//swoole_timer_after(1000, function(){
//    echo '你好1秒';
//});
?>

<form action="#" method="post">
    <textarea name="data" id="" cols="30" rows="10"></textarea>
    <input type="submit" name="sub" />
</form>
